package binary_search.leetcode_278;

public class FirstBadVersion extends VersionControl {
    public int firstBadVersion(int n) {
        int left = 1;
        int right = n;
        while(left < right){
            int mid = left + (right - left) / 2;
            if(isBadVersion(mid)){
                //true
                right = mid;
            }else{
                left = mid + 1;
            }
        }
        return left;
    }
}
